package com.cagtwitter.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cagtwitter.services.BaseParams;
import com.cagtwitter.services.WebDataServices;



@WebServlet(urlPatterns = { "/UserDetails" })

public class UserDetails extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UserDetails() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Properties properties = new Properties();
		WebDataServices wds = new WebDataServices();
		
		PrintWriter out = response.getWriter();
		
		properties.setProperty("screen_name",request.getParameter("screen_name"));

	    out.println(wds.getJsonFromUrl(BaseParams.USER_DETAILS,properties));
	    out.close();
	}
	
	// Parameters : screen_name
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Properties properties = new Properties();
		WebDataServices wds = new WebDataServices();
		
		PrintWriter out = response.getWriter();
		
		properties.setProperty("screen_name",request.getParameter("screen_name"));

	    out.println(wds.getJsonFromUrl(BaseParams.USER_DETAILS,properties));
	    out.close();
	}

}
